package com.dragonsoftbravo.sqlbuilder.dao;

import com.dragonsoftbravo.sqlbuilder.sql.ArgPair;
import com.dragonsoftbravo.sqlbuilder.sql.delete.Delete;
import com.dragonsoftbravo.sqlbuilder.sql.delete.DeleteConst;
import com.dragonsoftbravo.sqlbuilder.sql.delete.SqlDelete;
import com.dragonsoftbravo.sqlbuilder.sql.insert.Insert;
import com.dragonsoftbravo.sqlbuilder.sql.insert.InsertConst;
import com.dragonsoftbravo.sqlbuilder.sql.insert.SqlInsert;
import com.dragonsoftbravo.sqlbuilder.sql.query.Query;
import com.dragonsoftbravo.sqlbuilder.sql.query.QueryConst;
import com.dragonsoftbravo.sqlbuilder.sql.query.SqlQuery;
import com.dragonsoftbravo.sqlbuilder.sql.update.SqlUpdate;
import com.dragonsoftbravo.sqlbuilder.sql.update.Update;
import com.dragonsoftbravo.sqlbuilder.sql.update.UpdateConst;

import java.util.Map;

public class SqlBuilder implements Query,Insert,Delete,Update{
	private String table;
	public SqlBuilder(String table){
		this.table = table;
	}

    public String getTable() {
        return table;
    }

    @Override
	public QueryConst query(String... args) {
		return query(false, args);
	}

	@Override
	public QueryConst query(boolean distinct, String... args) {
		return new SqlQuery(this).query(distinct, args);
	}

	@Override
	public QueryConst query(Iterable<String> args) {
		return query(false, args);
	}

	@Override
	public QueryConst query(boolean distinct, Iterable<String> args) {
		return new SqlQuery(this).query(distinct, args);
	}

	@Override
	public DeleteConst delete() {
		return new SqlDelete(this).delete();
	}

	@Override
	public InsertConst insert(Map<String, Object> args) {
		return new SqlInsert(this).insert(args);
	}

	@Override
	public InsertConst insert(ArgPair argPair) {
		return new SqlInsert(this).insert(argPair);
	}

	@Override
	public UpdateConst update(ArgPair argPair) {
		return new SqlUpdate(this).update(argPair);
	}

	@Override
	public UpdateConst update(Map<String, Object> args) {
		return new SqlUpdate(this).update(args);
	}
}
